﻿<Window x:Class="LiSAClient.WpfClient.View.Frame.Windows.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:frame="clr-namespace:LiSAClient.WpfClient.View.Frame"
        xmlns:menus="clr-namespace:LiSAClient.WpfClient.View.Frame.Menus"  
        Style="{StaticResource WindowStyle}"
        Title="LiSA" MinHeight="500" MinWidth="1024" Width="1124" WindowStartupLocation="CenterScreen" MaxHeight="{Binding MaxWindowHeight}" MaxWidth="{Binding MaxWindowWidth}">
    <Grid Background="{StaticResource MainWindowBackground}">
        <Grid.RowDefinitions>
            <RowDefinition Height="90"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Border Grid.Column="0" Style="{StaticResource HeaderStyle}">
            <Grid HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" >
                <Image Name="LogoImage" Style="{StaticResource LogoStyle}"></Image>
                <menus:MainMenu DataContext="{Binding MainMenu}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding Converter={StaticResource nullCheckToVisibilityConverterCore}}" />
                <frame:UserInfo DataContext="{Binding UserInfo}" HorizontalAlignment="Right" VerticalAlignment="Top"
                               Visibility="{Binding Converter={StaticResource nullCheckToVisibilityConverterCore}}" />
            </Grid>
        </Border>
        <DockPanel HorizontalAlignment="Stretch"  LastChildFill="True" Grid.Row="1" VerticalAlignment="Stretch" Grid.ColumnSpan="2">
            <menus:LeftMenu DockPanel.Dock="Left" DataContext="{Binding LeftMenu}" Width="230">
                <menus:LeftMenu.Visibility>
                    <Binding Path="DataContext.ShowMenues" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=Window}">
                        <Binding.Converter>
                            <BooleanToVisibilityConverter/>
                        </Binding.Converter>
                    </Binding>
                </menus:LeftMenu.Visibility>
            </menus:LeftMenu>
            <Grid Background="{StaticResource MainContentBackground}">
                <Border BorderThickness="0" Margin="20,20,20,20">
                    <ContentControl Content="{Binding CurrentContent}" ContentTemplateSelector="{StaticResource contentDataTemplateSelector}" Focusable="False"/>
                </Border>
                <frame:WaitFrame DataContext="{Binding Waiter}" Visibility="{Binding IsVisible, Converter={StaticResource boolToVisibilityConverter}}"/>
            </Grid>
        </DockPanel>
    </Grid>
</Window>
